
<title>Workflow.NET
	<%#actionname%>
	-<%#propertyname%></title>
<STYLE><%#stylesheet%></STYLE>
<script language=javascript>
var StoreVal = "";
var CheckVal ="0";
var TsCheckVal="0";

function getValues()
{
	var val3 = "";
	var val1="";
	var val2="";
	var SchType="";
	var rec =document.frm_schedule.count;

	var tsrec =document.frm_schedule.tscount;

	if(document.frm_schedule.ScheduleType[0].checked)
	{
	 	val1 = document.frm_schedule.sel_day.options[document.frm_schedule.sel_day.selectedIndex].value;
	 	val2 = "NO";

	 	if(document.frm_schedule.Wchk.checked)
	 	{

	 		val2 = "YES";

	 	}

	 	val3 = document.frm_schedule.time.value;
	 	//val4 = document.frm_schedule.time.count

	 	SchType = "W";
	}
	else if(document.frm_schedule.ScheduleType[1].checked){
	 	val1 = document.frm_schedule.timespan.value;
		val2 = "NO";

	 	if(document.frm_schedule.Tchk.checked)
	 		val2 = "YES";

		SchType = "T";
	}
	else if(document.frm_schedule.ScheduleType[2].checked){
		val1 = document.frm_schedule.Select3.value + "|" +document.frm_schedule.valueinput.value;
		val2 = document.frm_schedule.criteria.options[document.frm_schedule.criteria.selectedIndex].value;
		val3 = document.frm_schedule.days.value;

		SchType = "D";
	}


	OutputPath = document.frm_schedule.output.value;

	if(SchType != "")
	{

		StoreVal = SchType + "|" + OutputPath + "|" + val1 + "|" + val2 + "|" + val3 +"|" + rec.value + "|" + tsrec.value;
		submitform();
	}
	else
		alert("Please select an option.");

}

function setValues(){

	var SchedulerDetails = "<%#addedvalue%>";
	// alert(SchedulerDetails);
	document.frm_schedule.time.value	 = "00:00:00";
	document.frm_schedule.timespan.value = "0.00:00:00";

	var rec =document.frm_schedule.count;
	var rec1 =document.frm_schedule.tscount;
	//rec.style.visibility= 'hidden';
	//rec1.style.visibility= 'hidden';

	var W1 =document.frm_schedule.Wchk;
	W1.checked=false;

	var T1 =document.frm_schedule.Tchk;
	T1.checked=false;




	if(SchedulerDetails !== "")
	{
		var scheduler_array = SchedulerDetails.split("|");

		document.frm_schedule.Select3.selectedIndex = 2;
		Select3_onclick();

		document.frm_schedule.timespan.value = "0.00:00:00";
		document.frm_schedule.time.value	 = "00:00:00";

	// Weekly Schedule
		if(scheduler_array[0] == "W"){


				document.frm_schedule.ScheduleType[0].checked = true;
				for(i=0;i<document.frm_schedule.sel_day.options.length;i++){
					if(scheduler_array[2] == document.frm_schedule.sel_day.options[i].value){
						 document.frm_schedule.sel_day.options[i].selected = true;
						 break;
					}
				}

				if(scheduler_array[3] == "YES")


				document.frm_schedule.Wchk.checked = true;


				if (document.frm_schedule.Wchk.checked == true)
				{

							document.frm_schedule.count.value = scheduler_array[5];
							rec.style.visibility= 'visible';

				}
				else
				{
					rec.style.visibility= 'hidden';

				}

				document.frm_schedule.time.value = scheduler_array[4];


			}

	// Time Span Schedule
		else if(scheduler_array[0] == "T"){
				document.frm_schedule.ScheduleType[1].checked = true;
				document.frm_schedule.timespan.value = scheduler_array[2];


				if(scheduler_array[3] == "YES")
					document.frm_schedule.Tchk.checked = true;
					if (document.frm_schedule.Tchk.checked == true)
					{

						document.frm_schedule.tscount.value = scheduler_array[6];
						rec1.style.visibility= 'visible';

					}
					else
					{
						rec1.style.visibility= 'hidden';

					}
					//document.frm_schedule.tscount.value = scheduler_array[6];



		}
	// Date wise Schedule
		else if(scheduler_array[0] == "D"){
				document.frm_schedule.ScheduleType[2].checked = true;

				if(scheduler_array[2] == "Variable")
						document.frm_schedule.Select3.options[0].selected = true;
				if(scheduler_array[2] == "Content")
						document.frm_schedule.Select3.options[1].selected = true;
				if(scheduler_array[2] == "Value")
						document.frm_schedule.Select3.options[2].selected = true;
			  	Select3_onclick();

				if(scheduler_array[2] == "Value")
					document.frm_schedule.valueinput.value = scheduler_array[3];

				if(scheduler_array[2] == "Content" || scheduler_array[2] == "Variable"){
					for(i=0;i<document.frm_schedule.valueinput.options.length;i++){
						if(scheduler_array[3] == document.frm_schedule.valueinput.options[i].value){
							document.frm_schedule.valueinput.options[i].selected = true;
							break;
						}
					}
				}

				if(scheduler_array[4] == "IB")
						 document.frm_schedule.criteria.options[2].selected = true;
				else if(scheduler_array[4] == "IA")
						 document.frm_schedule.criteria.options[1].selected = true;

				document.frm_schedule.days.value = scheduler_array[5];
		}

		document.frm_schedule.output.value = scheduler_array[1];
	}
	else
		changeDiv("variablediv");
}

function submitform()
{

	var submitvalue="";
	submitvalue = StoreVal;
	document.frm_schedule._mode.value = submitvalue;
	document.frm_schedule.submit();
	//window.opener.properties("_hidtempstore",submitvalue);
	//window.opener.submitform("?mode=edit&<%#qspropertypagename%>=<%#propertypage%>&<%#qspropertyname%>=<%#propertyname%>&<%#SelectedItemQueryString%>");
	//window.close();
}


//added
		var valuediv = "<input id='valueinput' class='inputs'>";

		var variablediv = "<SELECT id='valueinput' class='gridtableinputs'>";
		variablediv += '<%#assignvariables%>';
		variablediv +=	"</SELECT>";

		var contentdiv = "<SELECT id='valueinput' class='gridtableinputs'>";
		contentdiv += '<%#assigncontent%>';
		contentdiv +=	"</SELECT>";

		var oexpr2;

		oexpr2 = document.getElementsByTagName("div")["expr2"];

 //Select3_onclick();

function changeDiv( divvar ){
			if( !oexpr2 )
				oexpr2 = document.getElementsByTagName("div")["expr2"];

			oexpr2.innerHTML = eval(divvar);
}

function Select3_onclick(){
	var oselect3 = document.getElementsByTagName("select")["Select3"];

		switch(oselect3.value)
		{
			case "Value": changeDiv("valuediv");
						break;
			case "Variable": changeDiv("variablediv");
						break;
			case "Content": changeDiv("contentdiv");
						break;
		}
	return false;
}

function callText()
{
var reccheck =document.frm_schedule.Wchk;
var cnt =document.frm_schedule.count;

if (reccheck.checked = true)
{
	if (CheckVal =="2")
	{
	CheckVal ="0";
	}
	if (CheckVal =="1")
   {
	reccheck.checked= false;
    cnt.style.visibility = 'hidden';
    CheckVal="2";

    }
	if (CheckVal == "0")
	{
	cnt.style.visibility = 'visible';
	CheckVal="1";

    }
}

}
function CalltsText()
{

var reccheck =document.frm_schedule.Tchk;
var cnt =document.frm_schedule.tscount;

if (reccheck.checked = true)
{
	if (TsCheckVal =="2")
	{
	TsCheckVal ="0";
	}
	if (TsCheckVal =="1")
   {
	reccheck.checked= false;
    cnt.style.visibility = 'hidden';
    TsCheckVal="2";

    }
	if (TsCheckVal == "0")
	{
	cnt.style.visibility = 'visible';
	TsCheckVal="1";

    }
}


}

//
</SCRIPT>

</head>
<body onload="setValues()" >
<form name="frm_schedule" method="post">
 <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor='#737373'>
  	<TR valign="top" bgcolor='white'>
		<TD height=18 align="center" colspan=5 class=propertiesboxheading>
			<b><FONT CLASS="HEADING3">Settings for Scheduler</font></b>
		</TD>
	</TR>
	<TR class=propertiesboxpropertytitle>
		<td colspan=3 >
		&nbsp;
		</td>
		<TD align=center >
			Recurring ?
		</TD>
		<TD align=center >
			Recurring Count
		</TD>
	</TR>
	<TR class=propertiesboxpropertytitle>
		<TD>
			<input type=radio value="W" name="ScheduleType"> Weekly
		</TD>
		<TD><select name="sel_day" class="gridtableinputs"><option value="">Choose</option>
			<option value="Monday">Monday</option><option value="Tuesday">Tuesday</option>
			<option value="Wednesday">Wednesday</option><option value="Thursday">Thursday</option>
			<option value="Friday">Friday</option><option value="Saturday">Saturday</option>
			<option value="Sunday">Sunday</option></select> &nbsp;Time&nbsp;
		</TD>
		<TD>
			<input type=text name="time" size=10  class="inputs"> hh:mm:ss
		</TD>
		<TD align=center>
			<input type=checkbox name="Wchk" onclick="callText();" value="Y"> Yes
		</TD>
		<TD align=center>
			<input type=text name="count" size=3 class="inputs">
		</TD>
	</TR>
	<TR class=propertiesboxpropertytitle>
		<TD>
			<input type=radio value="T" name="ScheduleType"> TimeSpan
		</TD>
		<TD colspan=2>
			<input type=text name="timespan" size=14  class="inputs"> d.hh:mm:ss
		</TD>
		<TD align=center>
			<input type=checkbox name="Tchk" onclick="CalltsText();" value="Y"> Yes
		</TD>
		<TD align=center>
			<input type=text name="tscount" size=3 class="inputs" >
		</TD>
	</TR>
	<tr class=propertiesboxpropertytitle>
		<td colspan=5>
			<input type=radio value="D" name="ScheduleType"> Date Criteria (mm/dd/yyyy)
		</td>
	</tr>
	<tr class=propertiesboxpropertytitle>
		<TD>
			<SELECT id="Select3" name="Select3" class="gridtableinputs" language="javascript" onchange="return Select3_onclick();" >
				<OPTION value="Variable">Variable</OPTION>
				<OPTION value="Content">Content</OPTION>
				<OPTION value="Value" >Value</OPTION>
			</SELECT>
		</TD>
		<TD colspan=2>
			<div id="expr2"></div>
		</TD>
		<TD>
			<select name="criteria" class="gridtableinputs">
				<option value="">Choose</option>
				<option value="IA">Initiate after</option>
				<option value="IB">Initiate before</option>
			</select>
		</TD>
		<TD>
			<input type=text name="days" class="inputs" size=3> day(s)
			<input type=hidden name="output">
		</TD>
	</TR>

	<TR class=propertiesboxpropertytitle>
		<TD  colspan=5 align="right" height="20">
			<input type="button" class="buttons" value="Update" style="width:<%#buttonwidth%>" name="btnok" onclick="getValues();" ID="Button1">
			<input type="button" class="buttons" value="Close" style="width:<%#buttonwidth%>" ID="btnCancel" onclick="window.close();" NAME="btnCancel">
		</TD>
	</TR>
 </table>
<input type="hidden" name="_mode" value=<%#addedvalue%>>
</form>
</body>

